﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Basis.Domain;
using Tanmia.Warehouse.Core;
using Tanmia.Basis.Data;

namespace Tanmia.Warehouse.Domain
{
    public class ItemCategoryDomain : BaseDomain<ItemCategory>
    {
        public ItemCategoryDomain(ISessionManager sessionManager)
            : base(sessionManager)
        {
        }

        public IList<ItemCategory> GetsWithHead()
        {
            IList<ItemCategory> itemCategories = Gets();
            itemCategories.Insert(0, ItemCategory.HeadItem);
            return itemCategories;
        }

        public IList<ItemCategory> GetParentsWithHead(ItemCategory entity)
        {
            //IList<ItemCategory> itemCategories = Gets(x => x.ItemCategoryID != entity.ItemCategoryID);
            IList<ItemCategory> itemCategories = (from itemCategory in Repository.RepositoryItems
                                                  where itemCategory.ItemCategoryID != entity.ItemCategoryID
                                                  select itemCategory).ToList<ItemCategory>();
            itemCategories.Insert(0, ItemCategory.HeadItem);
            return itemCategories;
        }
    }
}
